home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
smaltalk
/
manchest.lha
/
MANCHESTER
/
manchester
/
4.1
/
Cursor-fromString.st
< prev
next >
Wrap
Text File
|
1993-07-24
|
1KB
|
41 lines
" NAME Cursor-fromString
AUTHOR Bernard Horan <bernard@is.morgan.com>
CONTRIBUTOR Bernard Horan <bernard@is.morgan.com>
FUNCTION Cursor instance creation method
ST-VERSIONS 4.1
PREREQUISITES
CONFLICTS
DISTRIBUTION global
VERSION 4.0
DATE September 1992
SUMMARY One method to create a Cursor from a (small)
string. Emphasis may also be supplied. Originally written by Pieter S.
van der Meulen for VI2.3, and suitably amended. BH, 25/9/92"!
'From Objectworks\Smalltalk(R), Release 4.1 of 15 April 1992 on 10 September 1992 at 3:05:04 am'!
!Cursor class methodsFor: 'instance creation'!
fromString: aString emphasis: aSymbol
"Create a Cursor specified by aString.
Be sure to keep aString small, e.g. 'S' or '2'.
The emphasis is specified by aSymbol.
Originally written by Pieter S. van der Meulen for VI2.3
and subsequently amended by Bernard Horan, 10 September 1992"
"Cursor blank showWhile: [9 to: 0 by: -1 do: [:aNumber |
(Cursor fromString: aNumber printString emphasis: #bold)
showWhile: [(Delay forMilliseconds: 500) wait]]]"
| image text pixmap |
text := (Text string: aString emphasis: aSymbol) asComposedText.
pixmap := Pixmap extent: 16 @ 16.
text displayOn: pixmap graphicsContext at: pixmap bounds center - text bounds center.
image := pixmap asImage convertToPalette: MappedPalette whiteBlack.
^self
image: image
mask: (image copy palette: CoveragePalette monoMaskPalette)
hotSpot: 8 @ 8
name: 'temp'! !